home *** CD-ROM | disk | FTP | other *** search
/ Programmer Power Tools / Programmer Power Tools.iso / progjrn / pj_7_6.arc / WINDEV.ARC / AUXPRT.C < prev    next >
C/C++ Source or Header  |  1989-03-07  |  1KB  |  49 lines

  1. #define EXTERNAX
  2. #include <auxprt.h>
  3.  
  4. void FAR auxprt(char *str)
  5. {
  6.  
  7.     HWND hWnd;
  8.     int len = strlen(str);
  9.  
  10. /* use this section for windows */
  11. #if defined(WINAUX)
  12.   /* get the handle for winaux from win.ini */
  13.     hWnd = (HWND)GetProfileInt((LPSTR)"Winaux", (LPSTR)"hWnd", 0);
  14.   /* send over the buffer */
  15.     if (IsWindow(hWnd))
  16.     SendMessage(hWnd, WM_USER, (WORD)len, (LONG)(LPSTR)str);
  17. #endif
  18.  
  19. /* use this section for Presentation Manager */
  20. #if defined(PMAUX)
  21.     char hbuf[40];
  22.     SEL sel;
  23.     PCH pchBuf;
  24.     int i;
  25.  
  26.   /* get the string representation of the handle for pmaux from OS2.INI */
  27.     WinQueryProfileString(hAB, "PMaux", "hWnd", "", hbuf, 40);
  28.   /* convert to a handle */
  29.     hWnd = (HWND)atol(hbuf);
  30.     if (WinIsWindow(hAB, hWnd)) {
  31.       /* create a shared buffer which can be read by another process */
  32.         if (DosAllocSeg(len, &sel, SEG_GETTABLE) == 0) {
  33.           /* make a long pointer to the buffer */
  34.         pchBuf = MAKEP(sel,0);
  35.           /* load it up */
  36.            for (i = 0; i < len; i++)
  37.             *(pchBuf+i) = *(str+i);
  38.           /* send it over */
  39.         WinSendMsg(hWnd, WM_USER, (MPARAM)len, (MPARAM)sel);
  40.           /* free the buffer */
  41.         DosFreeSeg(sel);
  42.         }
  43.         else  /* error, ring the bell */
  44.         WinAlarm(HWND_DESKTOP, WA_WARNING);    
  45.     }
  46. #endif
  47. }
  48.  
  49.